<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="umsroot.css">
<TITLE>
Style rules
</TITLE>
</HEAD>
<BODY >
<A HREF="umsroot153.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot155.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H2 CLASS="section"><A NAME="htoc335">E.1</A>&nbsp;&nbsp;Style rules</H2>
<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">
There is one directory containing all code and its documentation (using sub-directories).
<LI CLASS="li-enumerate">Filenames<A NAME="@default1231"></A> are of form [a-z][a-z_]+ with extension .ecl .
<LI CLASS="li-enumerate">One file per module, one module per file.
<LI CLASS="li-enumerate">Each module is documented with comment directives.
<LI CLASS="li-enumerate">All required interfaces are defined in separate spec files which are included in the source with a <I>comment include</I> directive. This helps to separate specification and implementation code.
<LI CLASS="li-enumerate">The actual data of the problem is loaded dynamically from the Java interface; for stand-alone testing data files from the data directory are included in the correct modules.
<LI CLASS="li-enumerate">The file name is equal to the module name.
<LI CLASS="li-enumerate">Predicate names<A NAME="@default1232"></A> are of form [a-z][a-z_]*[0-9]* . Underscores are used to separate words. Digits should only be used at the end of the name. Words should be English.
<LI CLASS="li-enumerate">Variable names<A NAME="@default1233"></A> are of form [A-Z_][a-zA-Z]*[0-9]* . Separate words with capital letters. Digits should only be used at the end. Words should be English.
<LI CLASS="li-enumerate">The code should not contain singleton variables<A NAME="@default1234"></A>, unless their names start with _. The final program may not generate singleton warnings.
<LI CLASS="li-enumerate">Each exported predicate is documented with a comment directive<A NAME="@default1235"></A>.
<LI CLASS="li-enumerate">Clauses for a predicate must be consecutive.
<LI CLASS="li-enumerate">Base clauses should be stated before recursive cases.
<LI CLASS="li-enumerate">Input arguments should be placed before output arguments.
<LI CLASS="li-enumerate">Predicates which are not exported should be documented with a single line comment. It is possible to use comment directives instead.
<LI CLASS="li-enumerate">The sequence of predicates in a file is top-down with a (possibly empty) utility section at the end.
<LI CLASS="li-enumerate">All structures are defined in one file (e.g. flow_structures.ecl) and are documented with comment directives.
<LI CLASS="li-enumerate">Terms should not be used; instead use named structures<A NAME="@default1236"></A>.
<LI CLASS="li-enumerate">When possible, use do-loops instead of recursion.
<LI CLASS="li-enumerate">When possible, use separate predicates instead of disjunction<A NAME="@default1237"></A> or if-then-else.
<LI CLASS="li-enumerate">There should be no nested if-then-else<A NAME="@default1238"></A> construct in the code.
<LI CLASS="li-enumerate">All input data should be converted into structures at the beginning of the program; there should be no direct access to the data afterwards. 
<LI CLASS="li-enumerate">All integer constants<A NAME="@default1239"></A> should be parametrized via facts. There should be no integer values (others than 0 and 1) in rules.
<LI CLASS="li-enumerate">The final code should not use failure-loops<A NAME="@default1240"></A>; they are acceptable for debugging or testing purposes.
<LI CLASS="li-enumerate">Cuts (!) <A NAME="@default1241"></A> should be inserted only to eliminate clearly defined choice points.
<LI CLASS="li-enumerate">The final code may not contain open choice points, except for alternative solutions that still can be explored. This is verified with the tracer tool in the debugger.
<LI CLASS="li-enumerate">Customizable data facts should always be at the end of a file; their use is deprecated.
<LI CLASS="li-enumerate">The predicate member/2<A NAME="@default1242"></A> should only be used where backtracking is required; otherwise use memberchk/2<A NAME="@default1243"></A> to avoid hidden choice points.
<LI CLASS="li-enumerate">The final code may not contain dead code<A NAME="@default1244"></A> except in the file/module unsupported.ecl. This file should contain all program pieces which are kept for information/debugging, but which are not part of the deliverable.
<LI CLASS="li-enumerate">The test set(s) should exercise 100 percent of the final code. Conformity is checked with the line coverage profiler.
<LI CLASS="li-enumerate">Explicit unification (=/2) should be replaced with unification inside terms where possible.
<LI CLASS="li-enumerate">There is a top-level file (top.ecl) which can be used to generated all on-line documentation automatically.
<LI CLASS="li-enumerate">For each module, a module diagram is provided.
<LI CLASS="li-enumerate">For the top-level files, component diagrams are provided.
<LI CLASS="li-enumerate">Don't use ','/2 to make tuples.
<LI CLASS="li-enumerate">Don't use lists to make tuples.
<LI CLASS="li-enumerate">Avoid append/3 where possible, use accumulators instead.
</OL>
<HR>
<A HREF="umsroot153.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot155.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
